<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
</head>
<body>
	请输入您的搜索内容：
	<input type="text" class="search"/>
	<div id="addr">

	</div>
	<script type="text/javascript">
		$(function(){
			$(".search").bind("input propertychange", function(){
				var search = $(".search").val();
				$("#addr").empty();
				
				$.ajax({
					type:"GET",
					url:"http://localhost:9090/ajaxTest/ajax?search=" + search,
					dataType:"json"
				})
				.done(function(msg){
					showMatchAddr(msg);
				});
			});
			
			function showMatchAddr(list){
				list.forEach((item, index)=>{
					$("<div></div>").appendTo($("#addr")).text(item.name);
				});
			}
		});
	</script>
</html>